--[[ Copyright 2012, Chris Ho                               ]]--
--[[ MIT License (Please read the LICENSE file for details) ]]--

-- Known Skill Codes
SKILL_BASH = 8201;
SKILL_MAGNUMBREAK = 8202; -- Unknown
SKILL_DOUBLESTRAFE = 8207;
SKILL_ARROWSHOWER = 8208;
SKILL_ARROWREPEL = 8214;
SKILL_PIERCE = 8216;
SKILL_BRANDISHSPEAR = 8217;
SKILL_MAGNIFICAT = 8222;
SKILL_WEAPONQUICKEN = 8223;
SKILL_SIGHT = 8224;
SKILL_CRASH = 8225;
SKILL_REGAIN = 8226;
SKILL_TENDER = 8227;
SKILL_BENEDICTION = 8228;
SKILL_RECUPERATE = 8229;
SKILL_MENTALCURE = 8230;
SKILL_COMPRESS = 8231;
SKILL_PROVOKE = 8232;
SKILL_BERSERK = 8233;
SKILL_DECREASEAGI = 8234;
SKILL_SCAPEGOAT = 8235;
SKILL_LEXDIVINA = 8236;
SKILL_SENSE = 8237;

-- Skill Data Structure:
-- id: skill user's ID
-- code: skill ID/code
-- level: skill level
Skill = {};

function Skill.Create(_id, _code, _level)
  local instance = { id = _id, code = _code, level = _level };

  --[[ Measure skill range ]]--
  function instance:Estimate()
    if (self.code == 0) then
      return GetV(V_ATTACKRANGE, self.id);
    else
      return GetV(V_SKILLATTACKRANGE, self.id, self.code);
    end
  end

  return instance;
end

function Skill.None(_id)
  return Skill.Create(_id, 0, 0);
end